package org.pi.common.matrix.range

import org.pi.common.matrix.IntMatrix

trait IntRangeApi {
	/** implicit conversion to provide a Range with one
	 * element if an int is given, e.g. 5 is converted to 5~1~5.
	 */
	implicit def convertIntToIntRange(xParam: Int) = new IntRangeImpl(xParam)
	//implicit def convertIntRangeToIntMatrix(r : IntRange) : IntMatrix = r.toIntMatrix
	//implicit def convertIntToIntMatrix(xParam: Int) = new IntRangeImpl(xParam).toIntMatrix

	/** end as shortcut for -1 */
	def end : Int = -1

	/** ~~ provides 0:end */ 
	def ~~ = new IntRangeImpl(0,-1)

}

object Api extends IntRangeApi {
	def main(args: Array[String]):Unit = {
		println("start intrange test")
		var r1 = 10~20
		var r2 = 0~3~9
		//var r3 = 0~3~9~10
		println(r1)
		println(r2)
		println("end intrange test")
	}
}
